package cn.gson.springboot.model.pjos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.Objects;

/**
 * 维修主表
 */
@Entity
@Table(name = "maintain", schema = "springboot", catalog = "")
public class Maintain {
    private int tainId;                 //维修主表id
    private String tainType;            //退换货类型
    private String tainNote;            //退换货单号
    private String tainOrder;           //维修单号
    private String tainRece;            //接单人
    private Integer tainState;          //状态
    private Integer tainDelete;         //逻辑删除
    private Customer customerByCustomId;
    private List<MaintainDetail> details;
    private Collection<Course> coursesByTainId;
    private Collection<Interflow> interflowsByTainId;
    private Collection<Process> processesByTainId;

    public Maintain() {

    }

    @Id
    @Column(name = "tain_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getTainId() {
        return tainId;
    }

    public void setTainId(int tainId) {
        this.tainId = tainId;
    }

    @Basic
    @Column(name = "tain_type")
    public String getTainType() {
        return tainType;
    }

    public void setTainType(String tainType) {
        this.tainType = tainType;
    }

    @Basic
    @Column(name = "tain_note")
    public String getTainNote() {
        return tainNote;
    }

    public void setTainNote(String tainNote) {
        this.tainNote = tainNote;
    }

    @Basic
    @Column(name = "tain_order")
    public String getTainOrder() {
        return tainOrder;
    }

    public void setTainOrder(String tainOrder) {
        this.tainOrder = tainOrder;
    }

    @Basic
    @Column(name = "tain_rece")
    public String getTainRece() {
        return tainRece;
    }

    public void setTainRece(String tainRece) {
        this.tainRece = tainRece;
    }

    @Basic
    @Column(name = "tain_state")
    public Integer getTainState() {
        return tainState;
    }

    public void setTainState(Integer tainState) {
        this.tainState = tainState;
    }

    @Basic
    @Column(name = "tain_delete")
    public Integer getTainDelete() {
        return tainDelete;
    }

    public void setTainDelete(Integer tainDelete) {
        this.tainDelete = tainDelete;
    }

    @OneToMany(mappedBy = "maintainByTainId")
    public Collection<Course> getCoursesByTainId() {
        return coursesByTainId;
    }

    public void setCoursesByTainId(Collection<Course> coursesByTainId) {
        this.coursesByTainId = coursesByTainId;
    }

    @OneToMany(mappedBy = "maintainByTainId")
    public Collection<Interflow> getInterflowsByTainId() {
        return interflowsByTainId;
    }

    public void setInterflowsByTainId(Collection<Interflow> interflowsByTainId) {
        this.interflowsByTainId = interflowsByTainId;
    }

    @ManyToOne
    @JoinColumn(name = "custom_id", referencedColumnName = "custom_id")
    public Customer getCustomerByCustomId() {
        return customerByCustomId;
    }

    public void setCustomerByCustomId(Customer customerByCustomId) {
        this.customerByCustomId = customerByCustomId;
    }

    @OneToMany(mappedBy = "maintainByTainId")
    public List<MaintainDetail> getDetails() {
        return details;
    }

    public void setDetails(List<MaintainDetail> details) {
        this.details = details;
    }


    @OneToMany(mappedBy = "maintainByTainId")
    public Collection<Process> getProcessesByTainId() {
        return processesByTainId;
    }

    public void setProcessesByTainId(Collection<Process> processesByTainId) {
        this.processesByTainId = processesByTainId;
    }
}
